﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace S.PurchaseAndSales.Comain.Migrations
{
    public partial class updatePurchaseFormModel : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "TheDocumentNumber",
                table: "PurchaseFormModels",
                newName: "SheepType");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreateTime",
                table: "PurchaseFormModels",
                type: "datetime2",
                nullable: true,
                oldClrType: typeof(DateTime),
                oldType: "datetime2");

            migrationBuilder.AlterColumn<string>(
                name: "CreateBy",
                table: "PurchaseFormModels",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50);

            migrationBuilder.AddColumn<string>(
                name: "Buyer",
                table: "PurchaseFormModels",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<DateTime>(
                name: "DateOfPurchase",
                table: "PurchaseFormModels",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Document",
                table: "PurchaseFormModels",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "SerialNumber",
                table: "PurchaseFormModels",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<int>(
                name: "VendorSnowId",
                table: "PurchaseFormModels",
                type: "int",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "Buyer",
                table: "PurchaseFormModels");

            migrationBuilder.DropColumn(
                name: "DateOfPurchase",
                table: "PurchaseFormModels");

            migrationBuilder.DropColumn(
                name: "Document",
                table: "PurchaseFormModels");

            migrationBuilder.DropColumn(
                name: "SerialNumber",
                table: "PurchaseFormModels");

            migrationBuilder.DropColumn(
                name: "VendorSnowId",
                table: "PurchaseFormModels");

            migrationBuilder.RenameColumn(
                name: "SheepType",
                table: "PurchaseFormModels",
                newName: "TheDocumentNumber");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CreateTime",
                table: "PurchaseFormModels",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
                oldClrType: typeof(DateTime),
                oldType: "datetime2",
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "CreateBy",
                table: "PurchaseFormModels",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "nvarchar(50)",
                oldMaxLength: 50,
                oldNullable: true);
        }
    }
}
